import request from '../../utils/request'

export function requestOrderList () {
    return new Promise(resolve => {
        request.get('/order/list').then(res => {
            resolve(res.data)
        })
    })
}

export function requestSendOrderlist () {
    return new Promise(resolve => {
        request.get('/order/sendlist').then(res => {
            resolve(res.data)
        })
    })
}

export function requestCompeleteOrderlist () {
    return new Promise(resolve => {
        request.get('/order/completelist').then(res => {
            resolve(res.data)
        })
    })
}

export function requestReturnQuestlist () {
    return new Promise(resolve => {
        request.get('/order/returnlist').then(res => {
            resolve(res.data)
        })
    })
}

export function requestModifiedOrderToSend (orderid, msg) {
    console.log(orderid, msg)
    return new Promise(resolve => {
        request.put('/order/send', {
            orderid,
            msg
        }).then(res => {
            resolve(res.data)
        })
    })
}

export function requestModifiedNoStoreOrder (orderid) {
    return new Promise(resolve => {
        request.put('/order/nostore', {
            orderid
        }).then(res => {
            resolve(res.data)
        })
    })
}

export function requestModifiedCanReturnOrder (orderid) {
    return new Promise(resolve => {
        request.put('/order/return', {
            orderid
        }).then(res => {
            resolve(res.data)
        })
    })
}
